//
//  GongSiModel.swift
//  WaiBao
//
//  Created by 赵佟越 on 17/5/15.
//  Copyright © 2017年 zhaotongyue. All rights reserved.
//

import UIKit
import HandyJSON
import SwiftyJSON
struct GongSiModel{
    let id : String
    let uname : String
    let name : String
    let uid : String
    let hdphoto : String
    let gradeId : String
    
    init(json:JSON){
        self.id =  json["id"].stringValue
        self.uname =  json["uname"].stringValue
        self.name =  json["name"].stringValue
        self.uid =  json["uid"].stringValue
        self.hdphoto =  json["hdphoto"].stringValue
        self.gradeId =  json["grade_id"].stringValue
    }
    
    func toDict() -> [String:Any]{
        var dict : [String:Any] = [ : ]
        dict["id"] = self.id
        dict["uname"] = self.uname
        dict["name"] = self.name
        dict["uid"] = self.uid
        dict["hdphoto"] = self.hdphoto
        dict["grade_id"] = self.gradeId
        return dict
    }
    static func transFormToArr(json:JSON) -> NSMutableArray{
        let tempArr = NSMutableArray()
        for i in 0...json.count - 1{
            let tempModel = GongSiModel.init(json: json[i])
            tempArr .add(tempModel)
        }
        return tempArr
    }
}
extension GongSiModel : CustomStringConvertible{
    var description:String {
        var builder = "GongSiModel["
        builder.append("id=\(id),")
        builder.append("uname=\(uname),")
        builder.append("name=\(name),")
        builder.append("uid=\(uid),")
        builder.append("hdphoto=\(hdphoto),")
        builder.append("gradeId=\(gradeId)")
        builder.append("]")
        return builder
    }
}
